﻿using System;
using System.Net;
using System.Xml.Linq;

namespace ArmoryBrowser.Entities
{
    public class Item
    {
        #region Fields
        private string _displayInfoIdField;
        private string _durabilityField;
        private string _gem0IdField;
        private string _gem1IdField;
        private string _gem2IdField;
        private string _gemIcon0Field;
        private string _gemIcon1Field;
        private string _iconField;
        private string _idField;
        private string _levelField;
        private string _maxDurabilityField;
        private string _nameField;
        private string _permanentEnchantIconField;
        private string _permanentEnchantItemIdField;
        private string _permanentenchantField;
        private string _pickUpField;
        private string _putDownField;
        private string _randomPropertiesIdField;
        private string _rarityField;
        private string _seedField;
        private string _slotField;
        #endregion
        #region Properties
        public string DisplayInfoId
        {
            get
            {
                return this._displayInfoIdField;
            }
            set
            {
                this._displayInfoIdField = value;
            }
        }

        public string Durability
        {
            get
            {
                return this._durabilityField;
            }
            set
            {
                this._durabilityField = value;
            }
        }

        public string Gem0Id
        {
            get
            {
                return this._gem0IdField;
            }
            set
            {
                this._gem0IdField = value;
            }
        }

        public string Gem1Id
        {
            get
            {
                return this._gem1IdField;
            }
            set
            {
                this._gem1IdField = value;
            }
        }

        public string Gem2Id
        {
            get
            {
                return this._gem2IdField;
            }
            set
            {
                this._gem2IdField = value;
            }
        }

        public string GemIcon0
        {
            get
            {
                return this._gemIcon0Field;
            }
            set
            {
                this._gemIcon0Field = value;
            }
        }

        public string GemIcon1
        {
            get
            {
                return this._gemIcon1Field;
            }
            set
            {
                this._gemIcon1Field = value;
            }
        }

        public string Icon
        {
            get
            {
                return this._iconField;
            }
            set
            {
                this._iconField = value;
            }
        }

        public string IconPath
        {
            get
            {
                return String.Format("http://armory.wow-europe.com/wow-icons/_images/51x51/{0}.jpg", Icon);
            }
        }
        public string Id
        {
            get
            {
                return this._idField;
            }
            set
            {
                this._idField = value;
            }
        }

        public string Level
        {
            get
            {
                return this._levelField;
            }
            set
            {
                this._levelField = value;
            }
        }

        public string MaxDurability
        {
            get
            {
                return this._maxDurabilityField;
            }
            set
            {
                this._maxDurabilityField = value;
            }
        }

        public string Name
        {
            get
            {
                return this._nameField;
            }
            set
            {
                this._nameField = value;
            }
        }

        public string PermanentEnchantIcon
        {
            get
            {
                return this._permanentEnchantIconField;
            }
            set
            {
                this._permanentEnchantIconField = value;
            }
        }

        public string PermanentEnchantItemId
        {
            get
            {
                return this._permanentEnchantItemIdField;
            }
            set
            {
                this._permanentEnchantItemIdField = value;
            }
        }

        public string Permanentenchant
        {
            get
            {
                return this._permanentenchantField;
            }
            set
            {
                this._permanentenchantField = value;
            }
        }

        public string PickUp
        {
            get
            {
                return this._pickUpField;
            }
            set
            {
                this._pickUpField = value;
            }
        }

        public string PutDown
        {
            get
            {
                return this._putDownField;
            }
            set
            {
                this._putDownField = value;
            }
        }

        public string RandomPropertiesId
        {
            get
            {
                return this._randomPropertiesIdField;
            }
            set
            {
                this._randomPropertiesIdField = value;
            }
        }

        public string Rarity
        {
            get
            {
                return this._rarityField;
            }
            set
            {
                this._rarityField = value;
            }
        }

        public string Seed
        {
            get
            {
                return this._seedField;
            }
            set
            {
                this._seedField = value;
            }
        }

        public string Slot
        {
            get
            {
                return this._slotField;
            }
            set
            {
                this._slotField = value;
            }
        }
        #endregion
        #region Constructor
        public Item(XElement element)
        {
            DisplayInfoId = element.GetAttributeValue("displayInfoId");
            Durability = element.GetAttributeValue("durability");
            Gem0Id = element.GetAttributeValue("gem0Id");
            Gem1Id = element.GetAttributeValue("gem1Id");
            Gem2Id = element.GetAttributeValue("gem2Id");
            GemIcon0 = element.GetAttributeValue("gemIcon0");
            GemIcon1 = element.GetAttributeValue("gemIcon1");
            Icon = element.GetAttributeValue("icon");
            Id = element.GetAttributeValue("id");
            Level = element.GetAttributeValue("level");
            MaxDurability = element.GetAttributeValue("maxDurability");
            Name = element.GetAttributeValue("name");
            PermanentEnchantIcon = element.GetAttributeValue("permanentEnchantIcon");
            PermanentEnchantItemId = element.GetAttributeValue("permanentEnchantItemId");
            Permanentenchant = element.GetAttributeValue("permanentenchant");
            PickUp = element.GetAttributeValue("pickUp");
            PutDown = element.GetAttributeValue("putDown");
            RandomPropertiesId = element.GetAttributeValue("randomPropertiesId");
            Rarity = element.GetAttributeValue("rarity");
            Seed = element.GetAttributeValue("seed");
            Slot = element.GetAttributeValue("slot");
        }
        #endregion
    }
}
